package org.demo;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public  class ExcelWriter {

	public static void main(String[] args) throws Exception {
		XSSFWorkbook wb = new XSSFWorkbook();
		XSSFCellStyle css=wb.createCellStyle();
		DataFormat  format = wb.createDataFormat();
		css.setDataFormat(format.getFormat("@"));
		XSSFSheet sheet = wb.createSheet("1232");
		sheet.setDefaultColumnStyle('R'-'A', css);
		XSSFRow row=sheet.createRow(0);
		XSSFCell cell=row.createCell('A'-'A',XSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("aaaa");
		FileOutputStream output=new FileOutputStream(new File("C:\\Users\\Administrator\\Desktop\\0516\\123.xlsx"));
		wb.write(output);
		output.flush();
		output.close();

	}

}
